<!DOCTYPE html>
<html lang="en-US">
  <head>
    <meta charset="utf-8">
    <meta name="viewport" content="width=device-width,initial-scale=1">
    <title>ansible 安装 | 小鹏杂谈</title>
    <meta name="generator" content="VuePress 1.8.2">
    <link rel="icon" href="/favicon.ico">
    <meta name="description" content="小鹏杂谈">
    <meta name="viewport" content="width=device-width,initial-scale=1,user-scalable=no">
    
    <link rel="preload" href="/assets/css/0.styles.8516fda1.css" as="style"><link rel="preload" href="/assets/js/app.b9ccfc55.js" as="script"><link rel="preload" href="/assets/js/4.8390fbcb.js" as="script"><link rel="preload" href="/assets/js/1.3334f995.js" as="script"><link rel="preload" href="/assets/js/61.f58e6c18.js" as="script"><link rel="prefetch" href="/assets/js/10.8eb4e356.js"><link rel="prefetch" href="/assets/js/11.31befa4c.js"><link rel="prefetch" href="/assets/js/12.da37eb75.js"><link rel="prefetch" href="/assets/js/13.b24ba73c.js"><link rel="prefetch" href="/assets/js/14.3bbed283.js"><link rel="prefetch" href="/assets/js/15.fac60f8d.js"><link rel="prefetch" href="/assets/js/16.b75d2036.js"><link rel="prefetch" href="/assets/js/17.116317c5.js"><link rel="prefetch" href="/assets/js/18.80fdbeda.js"><link rel="prefetch" href="/assets/js/19.459fc46f.js"><link rel="prefetch" href="/assets/js/20.452f30f9.js"><link rel="prefetch" href="/assets/js/21.99f641dc.js"><link rel="prefetch" href="/assets/js/22.081dc33b.js"><link rel="prefetch" href="/assets/js/23.d3455a59.js"><link rel="prefetch" href="/assets/js/24.8f5d39e0.js"><link rel="prefetch" href="/assets/js/25.c3dc47fb.js"><link rel="prefetch" href="/assets/js/26.d93b5cf2.js"><link rel="prefetch" href="/assets/js/27.6d2089a5.js"><link rel="prefetch" href="/assets/js/28.57336847.js"><link rel="prefetch" href="/assets/js/29.903b5e06.js"><link rel="prefetch" href="/assets/js/3.32100170.js"><link rel="prefetch" href="/assets/js/30.274666a3.js"><link rel="prefetch" href="/assets/js/31.fa9bd0f8.js"><link rel="prefetch" href="/assets/js/32.20179720.js"><link rel="prefetch" href="/assets/js/33.2dcc611d.js"><link rel="prefetch" href="/assets/js/34.ba79122c.js"><link rel="prefetch" href="/assets/js/35.bcd9298f.js"><link rel="prefetch" href="/assets/js/36.bf6245d9.js"><link rel="prefetch" href="/assets/js/37.734eb893.js"><link rel="prefetch" href="/assets/js/38.26999070.js"><link rel="prefetch" href="/assets/js/39.cc1f016d.js"><link rel="prefetch" href="/assets/js/40.da84c263.js"><link rel="prefetch" href="/assets/js/41.a96b8efa.js"><link rel="prefetch" href="/assets/js/42.d586cccb.js"><link rel="prefetch" href="/assets/js/43.69bb61aa.js"><link rel="prefetch" href="/assets/js/44.3be5a840.js"><link rel="prefetch" href="/assets/js/45.208a3bc3.js"><link rel="prefetch" href="/assets/js/46.2d6cacad.js"><link rel="prefetch" href="/assets/js/47.5add378a.js"><link rel="prefetch" href="/assets/js/48.587139cc.js"><link rel="prefetch" href="/assets/js/49.57f7c25a.js"><link rel="prefetch" href="/assets/js/5.ff1e84d1.js"><link rel="prefetch" href="/assets/js/50.efde6e4a.js"><link rel="prefetch" href="/assets/js/51.c9447e5f.js"><link rel="prefetch" href="/assets/js/52.57a51c35.js"><link rel="prefetch" href="/assets/js/53.4be0f240.js"><link rel="prefetch" href="/assets/js/54.8dabd349.js"><link rel="prefetch" href="/assets/js/55.3b8ae0e4.js"><link rel="prefetch" href="/assets/js/56.07e830b2.js"><link rel="prefetch" href="/assets/js/57.8c0dbdcc.js"><link rel="prefetch" href="/assets/js/58.63387df6.js"><link rel="prefetch" href="/assets/js/59.959bb8c8.js"><link rel="prefetch" href="/assets/js/6.56a2b5cd.js"><link rel="prefetch" href="/assets/js/60.1041d86f.js"><link rel="prefetch" href="/assets/js/62.a1a460c7.js"><link rel="prefetch" href="/assets/js/63.6c611c7d.js"><link rel="prefetch" href="/assets/js/64.6711119c.js"><link rel="prefetch" href="/assets/js/65.4655c3b1.js"><link rel="prefetch" href="/assets/js/66.e5dfe864.js"><link rel="prefetch" href="/assets/js/67.37515de0.js"><link rel="prefetch" href="/assets/js/68.0c8ba92d.js"><link rel="prefetch" href="/assets/js/69.52121d38.js"><link rel="prefetch" href="/assets/js/7.6f143d9f.js"><link rel="prefetch" href="/assets/js/70.1ab4d6a1.js"><link rel="prefetch" href="/assets/js/71.dc99dd1d.js"><link rel="prefetch" href="/assets/js/72.02e21e52.js"><link rel="prefetch" href="/assets/js/73.21efc121.js"><link rel="prefetch" href="/assets/js/74.649f4e1d.js"><link rel="prefetch" href="/assets/js/75.331c13e7.js"><link rel="prefetch" href="/assets/js/76.a94b5ff0.js"><link rel="prefetch" href="/assets/js/8.d4d40f2a.js"><link rel="prefetch" href="/assets/js/9.1b8824e7.js">
    <link rel="stylesheet" href="/assets/css/0.styles.8516fda1.css">
  </head>
  <body>
    <div id="app" data-server-rendered="true"><div class="theme-container no-sidebar" data-v-1156296a><div data-v-1156296a><div id="loader-wrapper" class="loading-wrapper" data-v-d48f4d20 data-v-1156296a data-v-1156296a><div class="loader-main" data-v-d48f4d20><div data-v-d48f4d20></div><div data-v-d48f4d20></div><div data-v-d48f4d20></div><div data-v-d48f4d20></div></div> <!----> <!----></div> <div class="password-shadow password-wrapper-out" style="display:none;" data-v-4e82dffc data-v-1156296a data-v-1156296a><h3 class="title" data-v-4e82dffc data-v-4e82dffc>小鹏杂谈</h3> <p class="description" data-v-4e82dffc data-v-4e82dffc>小鹏杂谈</p> <label id="box" class="inputBox" data-v-4e82dffc data-v-4e82dffc><input type="password" value="" data-v-4e82dffc> <span data-v-4e82dffc>Konck! Knock!</span> <button data-v-4e82dffc>OK</button></label> <div class="footer" data-v-4e82dffc data-v-4e82dffc><span data-v-4e82dffc><i class="iconfont reco-theme" data-v-4e82dffc></i> <a target="blank" href="https://vuepress-theme-reco.recoluan.com" data-v-4e82dffc>vuePress-theme-reco</a></span> <span data-v-4e82dffc><i class="iconfont reco-copyright" data-v-4e82dffc></i> <a data-v-4e82dffc><span data-v-4e82dffc>lzpeng723</span>
            
          <span data-v-4e82dffc>2021 - </span>
          2022
        </a></span></div></div> <div class="hide" data-v-1156296a><header class="navbar" data-v-1156296a><div class="sidebar-button"><svg xmlns="http://www.w3.org/2000/svg" aria-hidden="true" role="img" viewBox="0 0 448 512" class="icon"><path fill="currentColor" d="M436 124H12c-6.627 0-12-5.373-12-12V80c0-6.627 5.373-12 12-12h424c6.627 0 12 5.373 12 12v32c0 6.627-5.373 12-12 12zm0 160H12c-6.627 0-12-5.373-12-12v-32c0-6.627 5.373-12 12-12h424c6.627 0 12 5.373 12 12v32c0 6.627-5.373 12-12 12zm0 160H12c-6.627 0-12-5.373-12-12v-32c0-6.627 5.373-12 12-12h424c6.627 0 12 5.373 12 12v32c0 6.627-5.373 12-12 12z"></path></svg></div> <a href="/" class="home-link router-link-active"><img src="/logo.png" alt="小鹏杂谈" class="logo"> <span class="site-name">小鹏杂谈</span></a> <div class="links"><div class="color-picker"><a class="color-button"><i class="iconfont reco-color"></i></a> <div class="color-picker-menu" style="display:none;"><div class="mode-options"><h4 class="title">Choose mode</h4> <ul class="color-mode-options"><li class="dark">dark</li><li class="auto active">auto</li><li class="light">light</li></ul></div></div></div> <div class="search-box"><i class="iconfont reco-search"></i> <input aria-label="Search" autocomplete="off" spellcheck="false" value=""> <!----></div> <nav class="nav-links can-hide"><div class="nav-item"><a href="/" class="nav-link"><i class="iconfont reco-home"></i>
  首页
</a></div><div class="nav-item"><div class="dropdown-wrapper"><a class="dropdown-title"><span class="title"><i class="iconfont reco-category"></i>
      分类
    </span> <span class="arrow right"></span></a> <ul class="nav-dropdown" style="display:none;"><li class="dropdown-item"><!----> <a href="/categories/运维/" class="nav-link"><i class="undefined"></i>
  运维
</a></li><li class="dropdown-item"><!----> <a href="/categories/开发/" class="nav-link"><i class="undefined"></i>
  开发
</a></li><li class="dropdown-item"><!----> <a href="/categories/后端/" class="nav-link"><i class="undefined"></i>
  后端
</a></li><li class="dropdown-item"><!----> <a href="/categories/前端/" class="nav-link"><i class="undefined"></i>
  前端
</a></li><li class="dropdown-item"><!----> <a href="/categories/软件/" class="nav-link"><i class="undefined"></i>
  软件
</a></li><li class="dropdown-item"><!----> <a href="/categories/文档/" class="nav-link"><i class="undefined"></i>
  文档
</a></li><li class="dropdown-item"><!----> <a href="/categories/数据库/" class="nav-link"><i class="undefined"></i>
  数据库
</a></li><li class="dropdown-item"><!----> <a href="/categories/Node.js/" class="nav-link"><i class="undefined"></i>
  Node.js
</a></li><li class="dropdown-item"><!----> <a href="/categories/游戏/" class="nav-link"><i class="undefined"></i>
  游戏
</a></li></ul></div></div><div class="nav-item"><a href="/tag/" class="nav-link"><i class="iconfont reco-tag"></i>
  标签
</a></div><div class="nav-item"><a href="/timeline/" class="nav-link"><i class="iconfont reco-date"></i>
  时间线
</a></div><div class="nav-item"><div class="dropdown-wrapper"><a class="dropdown-title"><span class="title"><i class="iconfont reco-message"></i>
      文档
    </span> <span class="arrow right"></span></a> <ul class="nav-dropdown" style="display:none;"><li class="dropdown-item"><!----> <a href="/docs/minimal-boot/" class="nav-link"><i class="undefined"></i>
  minimal-boot
</a></li><li class="dropdown-item"><!----> <a href="/docs/minimal-cloud/" class="nav-link"><i class="undefined"></i>
  minimal-cloud
</a></li></ul></div></div><div class="nav-item"><div class="dropdown-wrapper"><a class="dropdown-title"><span class="title"><i class="iconfont reco-message"></i>
      联系方式
    </span> <span class="arrow right"></span></a> <ul class="nav-dropdown" style="display:none;"><li class="dropdown-item"><!----> <a href="https://github.com/lzpeng723" target="_blank" rel="noopener noreferrer" class="nav-link external"><i class="iconfont reco-github"></i>
  GitHub
  <span><svg xmlns="http://www.w3.org/2000/svg" aria-hidden="true" focusable="false" x="0px" y="0px" viewBox="0 0 100 100" width="15" height="15" class="icon outbound"><path fill="currentColor" d="M18.8,85.1h56l0,0c2.2,0,4-1.8,4-4v-32h-8v28h-48v-48h28v-8h-32l0,0c-2.2,0-4,1.8-4,4v56C14.8,83.3,16.6,85.1,18.8,85.1z"></path> <polygon fill="currentColor" points="45.7,48.7 51.3,54.3 77.2,28.5 77.2,37.2 85.2,37.2 85.2,14.9 62.8,14.9 62.8,22.9 71.5,22.9"></polygon></svg> <span class="sr-only">(opens new window)</span></span></a></li><li class="dropdown-item"><!----> <a href="https://gitee.com/lzpeng723" target="_blank" rel="noopener noreferrer" class="nav-link external"><i class="iconfont reco-mayun"></i>
  Gitee
  <span><svg xmlns="http://www.w3.org/2000/svg" aria-hidden="true" focusable="false" x="0px" y="0px" viewBox="0 0 100 100" width="15" height="15" class="icon outbound"><path fill="currentColor" d="M18.8,85.1h56l0,0c2.2,0,4-1.8,4-4v-32h-8v28h-48v-48h28v-8h-32l0,0c-2.2,0-4,1.8-4,4v56C14.8,83.3,16.6,85.1,18.8,85.1z"></path> <polygon fill="currentColor" points="45.7,48.7 51.3,54.3 77.2,28.5 77.2,37.2 85.2,37.2 85.2,14.9 62.8,14.9 62.8,22.9 71.5,22.9"></polygon></svg> <span class="sr-only">(opens new window)</span></span></a></li><li class="dropdown-item"><!----> <a href="https://www.zhihu.com/people/lzpeng723" target="_blank" rel="noopener noreferrer" class="nav-link external"><i class="iconfont reco-zhihu"></i>
  知乎
  <span><svg xmlns="http://www.w3.org/2000/svg" aria-hidden="true" focusable="false" x="0px" y="0px" viewBox="0 0 100 100" width="15" height="15" class="icon outbound"><path fill="currentColor" d="M18.8,85.1h56l0,0c2.2,0,4-1.8,4-4v-32h-8v28h-48v-48h28v-8h-32l0,0c-2.2,0-4,1.8-4,4v56C14.8,83.3,16.6,85.1,18.8,85.1z"></path> <polygon fill="currentColor" points="45.7,48.7 51.3,54.3 77.2,28.5 77.2,37.2 85.2,37.2 85.2,14.9 62.8,14.9 62.8,22.9 71.5,22.9"></polygon></svg> <span class="sr-only">(opens new window)</span></span></a></li></ul></div></div> <!----></nav></div></header> <div class="sidebar-mask" data-v-1156296a></div> <aside class="sidebar" data-v-1156296a><div class="personal-info-wrapper" data-v-828910c6 data-v-1156296a><img src="/avatar.jpg" alt="author-avatar" class="personal-img" data-v-828910c6> <h3 class="name" data-v-828910c6>
    lzpeng723
  </h3> <div class="num" data-v-828910c6><div data-v-828910c6><h3 data-v-828910c6>66</h3> <h6 data-v-828910c6>Articles</h6></div> <div data-v-828910c6><h3 data-v-828910c6>19</h3> <h6 data-v-828910c6>Tags</h6></div></div> <ul class="social-links" data-v-828910c6></ul> <hr data-v-828910c6></div> <nav class="nav-links"><div class="nav-item"><a href="/" class="nav-link"><i class="iconfont reco-home"></i>
  首页
</a></div><div class="nav-item"><div class="dropdown-wrapper"><a class="dropdown-title"><span class="title"><i class="iconfont reco-category"></i>
      分类
    </span> <span class="arrow right"></span></a> <ul class="nav-dropdown" style="display:none;"><li class="dropdown-item"><!----> <a href="/categories/运维/" class="nav-link"><i class="undefined"></i>
  运维
</a></li><li class="dropdown-item"><!----> <a href="/categories/开发/" class="nav-link"><i class="undefined"></i>
  开发
</a></li><li class="dropdown-item"><!----> <a href="/categories/后端/" class="nav-link"><i class="undefined"></i>
  后端
</a></li><li class="dropdown-item"><!----> <a href="/categories/前端/" class="nav-link"><i class="undefined"></i>
  前端
</a></li><li class="dropdown-item"><!----> <a href="/categories/软件/" class="nav-link"><i class="undefined"></i>
  软件
</a></li><li class="dropdown-item"><!----> <a href="/categories/文档/" class="nav-link"><i class="undefined"></i>
  文档
</a></li><li class="dropdown-item"><!----> <a href="/categories/数据库/" class="nav-link"><i class="undefined"></i>
  数据库
</a></li><li class="dropdown-item"><!----> <a href="/categories/Node.js/" class="nav-link"><i class="undefined"></i>
  Node.js
</a></li><li class="dropdown-item"><!----> <a href="/categories/游戏/" class="nav-link"><i class="undefined"></i>
  游戏
</a></li></ul></div></div><div class="nav-item"><a href="/tag/" class="nav-link"><i class="iconfont reco-tag"></i>
  标签
</a></div><div class="nav-item"><a href="/timeline/" class="nav-link"><i class="iconfont reco-date"></i>
  时间线
</a></div><div class="nav-item"><div class="dropdown-wrapper"><a class="dropdown-title"><span class="title"><i class="iconfont reco-message"></i>
      文档
    </span> <span class="arrow right"></span></a> <ul class="nav-dropdown" style="display:none;"><li class="dropdown-item"><!----> <a href="/docs/minimal-boot/" class="nav-link"><i class="undefined"></i>
  minimal-boot
</a></li><li class="dropdown-item"><!----> <a href="/docs/minimal-cloud/" class="nav-link"><i class="undefined"></i>
  minimal-cloud
</a></li></ul></div></div><div class="nav-item"><div class="dropdown-wrapper"><a class="dropdown-title"><span class="title"><i class="iconfont reco-message"></i>
      联系方式
    </span> <span class="arrow right"></span></a> <ul class="nav-dropdown" style="display:none;"><li class="dropdown-item"><!----> <a href="https://github.com/lzpeng723" target="_blank" rel="noopener noreferrer" class="nav-link external"><i class="iconfont reco-github"></i>
  GitHub
  <span><svg xmlns="http://www.w3.org/2000/svg" aria-hidden="true" focusable="false" x="0px" y="0px" viewBox="0 0 100 100" width="15" height="15" class="icon outbound"><path fill="currentColor" d="M18.8,85.1h56l0,0c2.2,0,4-1.8,4-4v-32h-8v28h-48v-48h28v-8h-32l0,0c-2.2,0-4,1.8-4,4v56C14.8,83.3,16.6,85.1,18.8,85.1z"></path> <polygon fill="currentColor" points="45.7,48.7 51.3,54.3 77.2,28.5 77.2,37.2 85.2,37.2 85.2,14.9 62.8,14.9 62.8,22.9 71.5,22.9"></polygon></svg> <span class="sr-only">(opens new window)</span></span></a></li><li class="dropdown-item"><!----> <a href="https://gitee.com/lzpeng723" target="_blank" rel="noopener noreferrer" class="nav-link external"><i class="iconfont reco-mayun"></i>
  Gitee
  <span><svg xmlns="http://www.w3.org/2000/svg" aria-hidden="true" focusable="false" x="0px" y="0px" viewBox="0 0 100 100" width="15" height="15" class="icon outbound"><path fill="currentColor" d="M18.8,85.1h56l0,0c2.2,0,4-1.8,4-4v-32h-8v28h-48v-48h28v-8h-32l0,0c-2.2,0-4,1.8-4,4v56C14.8,83.3,16.6,85.1,18.8,85.1z"></path> <polygon fill="currentColor" points="45.7,48.7 51.3,54.3 77.2,28.5 77.2,37.2 85.2,37.2 85.2,14.9 62.8,14.9 62.8,22.9 71.5,22.9"></polygon></svg> <span class="sr-only">(opens new window)</span></span></a></li><li class="dropdown-item"><!----> <a href="https://www.zhihu.com/people/lzpeng723" target="_blank" rel="noopener noreferrer" class="nav-link external"><i class="iconfont reco-zhihu"></i>
  知乎
  <span><svg xmlns="http://www.w3.org/2000/svg" aria-hidden="true" focusable="false" x="0px" y="0px" viewBox="0 0 100 100" width="15" height="15" class="icon outbound"><path fill="currentColor" d="M18.8,85.1h56l0,0c2.2,0,4-1.8,4-4v-32h-8v28h-48v-48h28v-8h-32l0,0c-2.2,0-4,1.8-4,4v56C14.8,83.3,16.6,85.1,18.8,85.1z"></path> <polygon fill="currentColor" points="45.7,48.7 51.3,54.3 77.2,28.5 77.2,37.2 85.2,37.2 85.2,14.9 62.8,14.9 62.8,22.9 71.5,22.9"></polygon></svg> <span class="sr-only">(opens new window)</span></span></a></li></ul></div></div> <!----></nav> <!----> </aside> <div class="password-shadow password-wrapper-in" style="display:none;" data-v-4e82dffc data-v-1156296a><h3 class="title" data-v-4e82dffc data-v-4e82dffc>ansible 安装</h3> <!----> <label id="box" class="inputBox" data-v-4e82dffc data-v-4e82dffc><input type="password" value="" data-v-4e82dffc> <span data-v-4e82dffc>Konck! Knock!</span> <button data-v-4e82dffc>OK</button></label> <div class="footer" data-v-4e82dffc data-v-4e82dffc><span data-v-4e82dffc><i class="iconfont reco-theme" data-v-4e82dffc></i> <a target="blank" href="https://vuepress-theme-reco.recoluan.com" data-v-4e82dffc>vuePress-theme-reco</a></span> <span data-v-4e82dffc><i class="iconfont reco-copyright" data-v-4e82dffc></i> <a data-v-4e82dffc><span data-v-4e82dffc>lzpeng723</span>
            
          <span data-v-4e82dffc>2021 - </span>
          2022
        </a></span></div></div> <div data-v-1156296a><main class="page"><section><div class="page-title"><h1 class="title">ansible 安装</h1> <div data-v-1ff7123e><i class="iconfont reco-account" data-v-1ff7123e><span data-v-1ff7123e>lzpeng723</span></i> <i class="iconfont reco-date" data-v-1ff7123e><span data-v-1ff7123e>10/16/2021</span></i> <!----> <i class="tags iconfont reco-tag" data-v-1ff7123e><span class="tag-item" data-v-1ff7123e>ansible</span></i></div></div> <div class="theme-reco-content content__default"><h2 id="ansible-简介"><a href="#ansible-简介" class="header-anchor">#</a> ansible 简介</h2> <h3 id="ansible-是什么"><a href="#ansible-是什么" class="header-anchor">#</a> ansible 是什么？</h3> <p>ansible是新出现的自动化运维工具，基于Python开发，集合了众多运维工具（puppet、chef、func、fabric）的优点，实现了批量系统配置、批量程序部署、批量运行命令等功能。
ansible是基于 paramiko 开发的,并且基于模块化工作，本身没有批量部署的能力。真正具有批量部署的是ansible所运行的模块，ansible只是提供一种框架。ansible不需要在远程主机上安装client/agents，因为它们是基于ssh来和远
程主机通讯的。ansible目前已经已经被红帽官方收购，是自动化运维工具中大家认可度最高的，并且上手容易，学习简单。是每位运维工程师必须掌握的技能之一。</p> <h3 id="ansible-特点"><a href="#ansible-特点" class="header-anchor">#</a> ansible 特点</h3> <ol><li>部署简单，只需在主控端部署Ansible环境，被控端无需做任何操作；</li> <li>默认使用SSH协议对设备进行管理；</li> <li>有大量常规运维操作模块，可实现日常绝大部分操作；</li> <li>配置简单、功能强大、扩展性强；</li> <li>支持API及自定义模块，可通过Python轻松扩展；</li> <li>通过Playbooks来定制强大的配置、状态管理；</li> <li>轻量级，无需在客户端安装agent，更新时，只需在操作机上进行一次更新即可；</li> <li>提供一个功能强大、操作性强的Web管理界面和REST API接口——AWX平台。</li></ol> <h3 id="ansible-架构图"><a href="#ansible-架构图" class="header-anchor">#</a> ansible 架构图</h3> <p><img src="https://images2017.cnblogs.com/blog/1204916/201712/1204916-20171205163000628-69838828.png" alt="ansible 架构图"></p> <p>上图中我们看到的主要模块如下：</p> <blockquote><p><code>Ansible</code>：Ansible核心程序。
<code>HostInventory</code>：记录由Ansible管理的主机信息，包括端口、密码、ip等。
<code>Playbooks</code>：“剧本”YAML格式文件，多个任务定义在一个文件中，定义主机需要调用哪些模块来完成的功能。
<code>CoreModules</code>：<strong>核心模块</strong>，主要操作是通过调用核心模块来完成管理任务。
<code>CustomModules</code>：自定义模块，完成核心模块无法完成的功能，支持多种语言。
<code>ConnectionPlugins</code>：连接插件，Ansible和Host通信使用</p></blockquote> <h2 id="ansible-任务执行"><a href="#ansible-任务执行" class="header-anchor">#</a> ansible 任务执行</h2> <h3 id="ansible-任务执行模式"><a href="#ansible-任务执行模式" class="header-anchor">#</a> ansible 任务执行模式</h3> <p>Ansible 系统由控制主机对被管节点的操作方式可分为两类，即<code>adhoc</code>和<code>playbook</code>：</p> <ul><li>ad-hoc模式(点对点模式)
使用单个模块，支持批量执行单条命令。ad-hoc 命令是一种可以快速输入的命令，而且不需要保存起来的命令。<strong>就相当于bash中的一句话shell。</strong></li> <li>playbook模式(剧本模式)
是Ansible主要管理方式，也是Ansible功能强大的关键所在。<strong>playbook通过多个task集合完成一类功能</strong>，如Web服务的安装部署、数据库服务器的批量备份等。可以简单地把playbook理解为通过组合多条ad-hoc操作的配置文件。</li></ul> <h3 id="ansible-执行流程"><a href="#ansible-执行流程" class="header-anchor">#</a> ansible 执行流程</h3> <p><img src="https://images2017.cnblogs.com/blog/1204916/201712/1204916-20171205162615738-1292598736.png" alt="ansible 执行流程">
简单理解就是Ansible在运行时， 首先读取<code>ansible.cfg</code>中的配置， 根据规则获取<code>Inventory</code>中的管理主机列表， 并行的在这些主机中执行配置的任务， 最后等待执行返回的结果。</p> <h3 id="ansible-命令执行过程"><a href="#ansible-命令执行过程" class="header-anchor">#</a> ansible 命令执行过程</h3> <ol><li>加载自己的配置文件，默认<code>/etc/ansible/ansible.cfg</code>；</li> <li>查找对应的主机配置文件，找到要执行的主机或者组；</li> <li>加载自己对应的模块文件，如 command；</li> <li>通过ansible将模块或命令生成对应的临时py文件(python脚本)， 并将该文件传输至远程服务器；</li> <li>对应执行用户的家目录的<code>.ansible/tmp/XXX/XXX.PY</code>文件；</li> <li>给文件 +x 执行权限；</li> <li>执行并返回结果；</li> <li>删除临时py文件，<code>sleep 0</code>退出；</li></ol> <h2 id="ansible-配置详解"><a href="#ansible-配置详解" class="header-anchor">#</a> ansible 配置详解</h2> <h3 id="ansible-安装方式"><a href="#ansible-安装方式" class="header-anchor">#</a> ansible 安装方式</h3> <p>ansible安装常用两种方式，<code>yum安装</code>和<code>pip程序安装</code>。下面我们来详细介绍一下这两种安装方式。</p> <h4 id="使用-pip-python的包管理模块-安装"><a href="#使用-pip-python的包管理模块-安装" class="header-anchor">#</a> 使用 pip（python的包管理模块）安装</h4> <p>首先，我们需要安装一个<code>python-pip</code>包，安装完成以后，则直接使用<code>pip</code>命令来安装我们的包，具体操作过程如下：</p> <div class="language- line-numbers-mode"><pre class="language-text"><code>yum install python-pip
pip install ansible
</code></pre> <div class="line-numbers-wrapper"><span class="line-number">1</span><br><span class="line-number">2</span><br></div></div><h4 id="使用-yum-安装"><a href="#使用-yum-安装" class="header-anchor">#</a> 使用 yum 安装</h4> <p>yum 安装是我们很熟悉的安装方式了。我们需要先安装一个<code>epel-release</code>包，然后再安装我们的 ansible 即可。</p> <div class="language- line-numbers-mode"><pre class="language-text"><code>yum install epel-release -y
yum install ansible –y
</code></pre> <div class="line-numbers-wrapper"><span class="line-number">1</span><br><span class="line-number">2</span><br></div></div><h3 id="ansible-程序结构"><a href="#ansible-程序结构" class="header-anchor">#</a> ansible 程序结构</h3> <p>安装目录如下(yum安装)：</p> <ul><li>配置文件目录：<code>/etc/ansible/</code></li> <li>执行文件目录：<code>/usr/bin/</code></li> <li>Lib库依赖目录：<code>/usr/lib/pythonX.X/site-packages/ansible/</code></li> <li>Help文档目录：<code>/usr/share/doc/ansible-X.X.X/</code></li> <li>Man文档目录：<code>/usr/share/man/man1/</code></li></ul> <h3 id="ansible配置文件查找顺序"><a href="#ansible配置文件查找顺序" class="header-anchor">#</a> ansible配置文件查找顺序</h3> <p>ansible与我们其他的服务在这一点上有很大不同，这里的配置文件查找是从多个地方找的，顺序如下：</p> <ol><li>检查环境变量<code>ANSIBLE_CONFIG</code>指向的路径文件(export ANSIBLE_CONFIG=/etc/ansible.cfg)；</li> <li><code>./ansible.cfg</code>，检查当前目录下的ansible.cfg配置文件；</li> <li><code>~/ansible.cfg</code>，检查当前用户家目录下的ansible.cfg配置文件；</li> <li><code>/etc/ansible/ansible.cfg</code>检查etc目录的配置文件。</li></ol> <h3 id="ansible-配置文件"><a href="#ansible-配置文件" class="header-anchor">#</a> ansible 配置文件</h3> <p>ansible 的配置文件为<code>/etc/ansible/ansible.cfg</code>，ansible 有许多参数，下面我们列出一些常见的参数：</p> <div class="language-yaml line-numbers-mode"><pre class="language-yaml"><code><span class="token punctuation">[</span>defaults<span class="token punctuation">]</span>
<span class="token comment"># 这个参数表示资源清单inventory文件的位置</span>
inventory = /etc/ansible/hosts
<span class="token comment"># 指向存放Ansible模块的目录，支持多个目录方式，只要用冒号（：）隔开就可以</span>
library = /usr/share/ansible
<span class="token comment"># 以什么用户远程被管理主机</span>
remote_user = lzpeng
<span class="token comment"># 是否校验密钥</span>
host_key_checking = False
<span class="token comment"># 并发连接数，默认为5</span>
forks = 5
<span class="token comment"># 设置默认执行命令的用户</span>
sudo_user = root
<span class="token comment"># 使用密钥还是密码远程</span>
ask_pass = True
<span class="token comment">#指定连接被管节点的管理端口，默认为22端口，建议修改，能够更加安全</span>
remote_port = 22
<span class="token comment"># 设置是否检查SSH主机的密钥，值为True/False。关闭后第一次连接不会提示配置实例</span>
host_key_checking = False
<span class="token comment"># 设置SSH连接的超时时间，单位为秒</span>
timeout = 60
<span class="token comment"># 指定一个存储ansible日志的文件（默认不记录日志）</span>
log_path = /var/log/ansible.log

<span class="token punctuation">[</span>privilege_escalation<span class="token punctuation">]</span>
<span class="token comment"># 是否需要切换用户</span>
become = True
<span class="token comment"># 如何切换用户</span>
become_method = sudo
<span class="token comment"># 切换成什么用户</span>
become_user = root
<span class="token comment"># sudo 是否需要输入密码</span>
become_ask_pass = False
</code></pre> <div class="line-numbers-wrapper"><span class="line-number">1</span><br><span class="line-number">2</span><br><span class="line-number">3</span><br><span class="line-number">4</span><br><span class="line-number">5</span><br><span class="line-number">6</span><br><span class="line-number">7</span><br><span class="line-number">8</span><br><span class="line-number">9</span><br><span class="line-number">10</span><br><span class="line-number">11</span><br><span class="line-number">12</span><br><span class="line-number">13</span><br><span class="line-number">14</span><br><span class="line-number">15</span><br><span class="line-number">16</span><br><span class="line-number">17</span><br><span class="line-number">18</span><br><span class="line-number">19</span><br><span class="line-number">20</span><br><span class="line-number">21</span><br><span class="line-number">22</span><br><span class="line-number">23</span><br><span class="line-number">24</span><br><span class="line-number">25</span><br><span class="line-number">26</span><br><span class="line-number">27</span><br><span class="line-number">28</span><br><span class="line-number">29</span><br><span class="line-number">30</span><br><span class="line-number">31</span><br><span class="line-number">32</span><br><span class="line-number">33</span><br></div></div><h3 id="ansible-主机清单"><a href="#ansible-主机清单" class="header-anchor">#</a> ansible 主机清单</h3> <p>在配置文件中，我们提到了资源清单，这个清单就是我们的主机清单，里面保存的是一些 ansible 需要连接管理的主机列表。我们可以来看看他的定义方式：</p> <div class="language-yaml line-numbers-mode"><pre class="language-yaml"><code><span class="token comment"># 添加以下内容</span>
<span class="token punctuation">[</span>test<span class="token punctuation">]</span> <span class="token comment"># 组名</span>
CentOS7<span class="token punctuation">-</span>Node1 ansible_ssh_port=220 <span class="token comment"># 自定义远程ssh端口</span>
<span class="token punctuation">[</span>proxy<span class="token punctuation">]</span>
CentOS7<span class="token punctuation">-</span>Node2 ansible_ssh_user=lzpeng <span class="token comment"># 自定义远程连接的账户名</span>
<span class="token punctuation">[</span>webserver<span class="token punctuation">]</span>
CentOS7<span class="token punctuation">-</span>Node<span class="token punctuation">[</span>3<span class="token punctuation">:</span><span class="token number">4</span><span class="token punctuation">]</span> ansible_ssh_pass=123456 <span class="token comment"># 自定义远程连接的账户名</span>
<span class="token punctuation">[</span>database<span class="token punctuation">]</span>
CentOS7<span class="token punctuation">-</span>Node5 ansible_ssh_private_key_file=220 <span class="token comment"># 自定义远程连接的账户名</span>
<span class="token punctuation">[</span>cluster<span class="token punctuation">:</span>children<span class="token punctuation">]</span> <span class="token comment"># 嵌套组</span>
webserver
database
</code></pre> <div class="line-numbers-wrapper"><span class="line-number">1</span><br><span class="line-number">2</span><br><span class="line-number">3</span><br><span class="line-number">4</span><br><span class="line-number">5</span><br><span class="line-number">6</span><br><span class="line-number">7</span><br><span class="line-number">8</span><br><span class="line-number">9</span><br><span class="line-number">10</span><br><span class="line-number">11</span><br><span class="line-number">12</span><br></div></div><p>需要注意的是，这里的组成员可以使用通配符来匹配，这样对于一些标准化的管理来说就很轻松方便了。</p> <p>我们可以根据实际情况来配置我们的主机列表，具体操作如下：</p> <div class="language-bash line-numbers-mode"><pre class="language-bash"><code><span class="token function">vim</span> ~/ansible/hosts

<span class="token comment"># 添加以下内容</span>
<span class="token punctuation">[</span>test<span class="token punctuation">]</span> <span class="token comment"># 组名</span>
CentOS7-Node1 <span class="token comment"># 主机名</span>
<span class="token punctuation">[</span>proxy<span class="token punctuation">]</span>
CentOS7-Node2
<span class="token punctuation">[</span>webserver<span class="token punctuation">]</span>
CentOS7-Node<span class="token punctuation">[</span><span class="token number">3</span>:4<span class="token punctuation">]</span> <span class="token comment"># 连续主机名</span>
<span class="token punctuation">[</span>database<span class="token punctuation">]</span>
CentOS7-Node5
<span class="token punctuation">[</span>cluster:children<span class="token punctuation">]</span> <span class="token comment"># 嵌套组</span>
webserver
database
</code></pre> <div class="line-numbers-wrapper"><span class="line-number">1</span><br><span class="line-number">2</span><br><span class="line-number">3</span><br><span class="line-number">4</span><br><span class="line-number">5</span><br><span class="line-number">6</span><br><span class="line-number">7</span><br><span class="line-number">8</span><br><span class="line-number">9</span><br><span class="line-number">10</span><br><span class="line-number">11</span><br><span class="line-number">12</span><br><span class="line-number">13</span><br><span class="line-number">14</span><br></div></div><h2 id="ansible-常用命令"><a href="#ansible-常用命令" class="header-anchor">#</a> ansible 常用命令</h2> <h3 id="ansible-命令集"><a href="#ansible-命令集" class="header-anchor">#</a> ansible 命令集</h3> <blockquote><p><code>/usr/bin/ansible</code>　　Ansibe AD-Hoc 临时命令执行工具，常用于临时命令的执行
<code>/usr/bin/ansible-doc</code> 　Ansible 模块功能查看工具
<code>/usr/bin/ansible-galaxy</code>　　下载/上传优秀代码或Roles模块 的官网平台，基于网络的
<code>/usr/bin/ansible-playbook</code>　　Ansible 定制自动化的任务集编排工具
<code>/usr/bin/ansible-pull</code>　　Ansible远程执行命令的工具，拉取配置而非推送配置（使用较少，海量机器时使用，对运维的架构能力要求较高）
<code>/usr/bin/ansible-vault</code>　　Ansible 文件加密工具
<code>/usr/bin/ansible-console</code>　　Ansible基于Linux Consoble界面可与用户交互的命令执行工具</p></blockquote> <p>其中，我们比较常用的是<code>/usr/bin/ansible</code>和<code>/usr/bin/ansible-playbook</code>。</p> <h3 id="ansible-doc-命令"><a href="#ansible-doc-命令" class="header-anchor">#</a> ansible-doc 命令</h3> <p>ansible-doc 命令常用于获取模块信息及其使用帮助，一般用法如下：</p> <div class="language-bash line-numbers-mode"><pre class="language-bash"><code>ansible-doc -l				<span class="token comment">#获取全部模块的信息</span>
ansible-doc -s MOD_NAME		<span class="token comment">#获取指定模块的使用帮助</span>
ansible-doc -s <span class="token operator">|</span> <span class="token function">wc</span> -l		<span class="token comment">#统计有多少模块</span>
</code></pre> <div class="line-numbers-wrapper"><span class="line-number">1</span><br><span class="line-number">2</span><br><span class="line-number">3</span><br></div></div><p>我们也可以查看一下ansible-doc的全部用法：</p> <div class="language-bash line-numbers-mode"><pre class="language-bash"><code>ansible-doc
Usage: ansible-doc <span class="token punctuation">[</span>options<span class="token punctuation">]</span> <span class="token punctuation">[</span>module<span class="token punctuation">..</span>.<span class="token punctuation">]</span>

Options:
  -h, --help            show this <span class="token builtin class-name">help</span> message and <span class="token builtin class-name">exit</span>　　<span class="token comment"># 显示命令参数API文档</span>
  -l, --list            List available modules　　<span class="token comment">#列出可用的模块</span>
  -M MODULE_PATH, --module-path<span class="token operator">=</span>MODULE_PATH　　<span class="token comment">#指定模块的路径</span>
                        specify path<span class="token punctuation">(</span>s<span class="token punctuation">)</span> to module library <span class="token punctuation">(</span>default<span class="token operator">=</span>None<span class="token punctuation">)</span>
  -s, --snippet         Show playbook snippet <span class="token keyword">for</span> specified module<span class="token punctuation">(</span>s<span class="token punctuation">)</span>　　<span class="token comment">#显示playbook制定模块的用法</span>
  -v, --verbose         verbose mode <span class="token punctuation">(</span>-vvv <span class="token keyword">for</span> more, -vvvv to <span class="token builtin class-name">enable</span>　　<span class="token comment"># 显示ansible-doc的版本号查看模块列表：</span>
                        connection debugging<span class="token punctuation">)</span>
  --version             show program's version number and <span class="token builtin class-name">exit</span>
</code></pre> <div class="line-numbers-wrapper"><span class="line-number">1</span><br><span class="line-number">2</span><br><span class="line-number">3</span><br><span class="line-number">4</span><br><span class="line-number">5</span><br><span class="line-number">6</span><br><span class="line-number">7</span><br><span class="line-number">8</span><br><span class="line-number">9</span><br><span class="line-number">10</span><br><span class="line-number">11</span><br><span class="line-number">12</span><br></div></div><p>我们可以来看一下，以yum相关的为例：</p> <div class="language-bash line-numbers-mode"><pre class="language-bash"><code>ansible-doc -l <span class="token operator">|</span> <span class="token function">grep</span> yum

yum                                                           Manages packages with the `yum' package manager                                                      
yum_repository                                                Add or remove YUM repositories      
ansible-doc -s yum
</code></pre> <div class="line-numbers-wrapper"><span class="line-number">1</span><br><span class="line-number">2</span><br><span class="line-number">3</span><br><span class="line-number">4</span><br><span class="line-number">5</span><br></div></div><h3 id="ansible-命令详解"><a href="#ansible-命令详解" class="header-anchor">#</a> ansible 命令详解</h3> <p>命令的具体格式如下：</p> <div class="language-bash line-numbers-mode"><pre class="language-bash"><code>ansible <span class="token operator">&lt;</span>host-pattern<span class="token operator">&gt;</span> <span class="token punctuation">[</span>-f forks<span class="token punctuation">]</span> <span class="token punctuation">[</span>-m module_name<span class="token punctuation">]</span> <span class="token punctuation">[</span>-a args<span class="token punctuation">]</span>
</code></pre> <div class="line-numbers-wrapper"><span class="line-number">1</span><br></div></div><p>也可以通过<code>ansible -h</code>来查看帮助，下面我们列出一些比较常用的选项，并解释其含义：</p> <blockquote><p><code>-a MODULE_ARGS</code>　　　#模块的参数，如果执行默认COMMAND的模块，即是命令参数，如： “date”，“pwd”等等
<code>-k</code>，<code>--ask-pass</code> #ask for SSH password。登录密码，提示输入SSH密码而不是假设基于密钥的验证
<code>--ask-su-pass</code> #ask for su password。su切换密码
<code>-K</code>，<code>--ask-sudo-pass</code> #ask for sudo password。提示密码使用sudo，sudo表示提权操作
<code>--ask-vault-pass</code> #ask for vault password。假设我们设定了加密的密码，则用该选项进行访问
<code>-B SECONDS</code> #后台运行超时时间
<code>-C</code> #模拟运行环境并进行预运行，可以进行查错测试
<code>-c CONNECTION</code> #连接类型使用
<code>-f FORKS</code> #并行任务数，默认为5
<code>-i INVENTORY</code> #指定主机清单的路径，默认为<code>/etc/ansible/hosts</code> <code>--list-hosts</code> #查看有哪些主机组
<code>-m MODULE_NAME</code> #执行模块的名字，默认使用 command 模块，所以如果是只执行单一命令可以不用 -m参数
<code>-o</code> #压缩输出，尝试将所有结果在一行输出，一般针对收集工具使用
<code>-S</code> #用 su 命令
<code>-R SU_USER</code> #指定 su 的用户，默认为 root 用户
<code>-s</code> #用 sudo 命令
<code>-U SUDO_USER</code> #指定 sudo 到哪个用户，默认为 root 用户
<code>-T TIMEOUT</code> #指定 ssh 默认超时时间，默认为10s，也可在配置文件中修改
<code>-u REMOTE_USER</code> #远程用户，默认为 root 用户
<code>-v</code> #查看详细信息，同时支持<code>-vvv</code>，<code>-vvvv</code>可查看更详细信息</p></blockquote> <h3 id="ansible-配置公私钥"><a href="#ansible-配置公私钥" class="header-anchor">#</a> ansible 配置公私钥</h3> <p>上面我们已经提到过 ansible 是基于 ssh 协议实现的，所以其配置公私钥的方式与 ssh 协议的方式相同，具体操作步骤如下：</p> <div class="language-bash line-numbers-mode"><pre class="language-bash"><code><span class="token comment"># 1.生成私钥</span>
ssh-keygen -f ~/.ssh/id_rsa -N <span class="token string">''</span>
<span class="token comment"># 2.向主机分发私钥</span>
<span class="token keyword">for</span> <span class="token for-or-select variable">i</span> <span class="token keyword">in</span> CentOS7-Node1 CentOS7-Node2 CentOS7-Node3 CentOS7-Node4 CentOS7-Node5
<span class="token keyword">do</span>
    ssh-copy-id <span class="token variable">$i</span>
<span class="token keyword">done</span>
</code></pre> <div class="line-numbers-wrapper"><span class="line-number">1</span><br><span class="line-number">2</span><br><span class="line-number">3</span><br><span class="line-number">4</span><br><span class="line-number">5</span><br><span class="line-number">6</span><br><span class="line-number">7</span><br></div></div><p>这样的话，就可以实现无密码登录，我们的实验过程也会顺畅很多。
注意，如果出现了一下报错：</p> <div class="language- line-numbers-mode"><pre class="language-text"><code>-bash: ssh-copy-id: command not found
</code></pre> <div class="line-numbers-wrapper"><span class="line-number">1</span><br></div></div><p>那么就证明我们需要安装一个包：</p> <div class="language-bash line-numbers-mode"><pre class="language-bash"><code>yum -y <span class="token function">install</span> openssh-clientsansible
</code></pre> <div class="line-numbers-wrapper"><span class="line-number">1</span><br></div></div><p>把包安装上即可。</p></div></section> <footer class="page-edit"><!----> <div class="last-updated"><span class="prefix">Last Updated: </span> <span class="time">1/28/2022, 8:09:41 AM</span></div></footer> <!----> <div class="comments-wrapper"><!----></div> <ul class="side-bar sub-sidebar-wrapper" style="width:12rem;" data-v-70334359><li class="level-2" data-v-70334359><a href="/blogs/ansible/ansible-install.html#ansible-简介" class="sidebar-link reco-side-ansible-简介" data-v-70334359>ansible 简介</a></li><li class="level-3" data-v-70334359><a href="/blogs/ansible/ansible-install.html#ansible-是什么" class="sidebar-link reco-side-ansible-是什么" data-v-70334359>ansible 是什么？</a></li><li class="level-3" data-v-70334359><a href="/blogs/ansible/ansible-install.html#ansible-特点" class="sidebar-link reco-side-ansible-特点" data-v-70334359>ansible 特点</a></li><li class="level-3" data-v-70334359><a href="/blogs/ansible/ansible-install.html#ansible-架构图" class="sidebar-link reco-side-ansible-架构图" data-v-70334359>ansible 架构图</a></li><li class="level-2" data-v-70334359><a href="/blogs/ansible/ansible-install.html#ansible-任务执行" class="sidebar-link reco-side-ansible-任务执行" data-v-70334359>ansible 任务执行</a></li><li class="level-3" data-v-70334359><a href="/blogs/ansible/ansible-install.html#ansible-任务执行模式" class="sidebar-link reco-side-ansible-任务执行模式" data-v-70334359>ansible 任务执行模式</a></li><li class="level-3" data-v-70334359><a href="/blogs/ansible/ansible-install.html#ansible-执行流程" class="sidebar-link reco-side-ansible-执行流程" data-v-70334359>ansible 执行流程</a></li><li class="level-3" data-v-70334359><a href="/blogs/ansible/ansible-install.html#ansible-命令执行过程" class="sidebar-link reco-side-ansible-命令执行过程" data-v-70334359>ansible 命令执行过程</a></li><li class="level-2" data-v-70334359><a href="/blogs/ansible/ansible-install.html#ansible-配置详解" class="sidebar-link reco-side-ansible-配置详解" data-v-70334359>ansible 配置详解</a></li><li class="level-3" data-v-70334359><a href="/blogs/ansible/ansible-install.html#ansible-安装方式" class="sidebar-link reco-side-ansible-安装方式" data-v-70334359>ansible 安装方式</a></li><li class="level-3" data-v-70334359><a href="/blogs/ansible/ansible-install.html#ansible-程序结构" class="sidebar-link reco-side-ansible-程序结构" data-v-70334359>ansible 程序结构</a></li><li class="level-3" data-v-70334359><a href="/blogs/ansible/ansible-install.html#ansible配置文件查找顺序" class="sidebar-link reco-side-ansible配置文件查找顺序" data-v-70334359>ansible配置文件查找顺序</a></li><li class="level-3" data-v-70334359><a href="/blogs/ansible/ansible-install.html#ansible-配置文件" class="sidebar-link reco-side-ansible-配置文件" data-v-70334359>ansible 配置文件</a></li><li class="level-3" data-v-70334359><a href="/blogs/ansible/ansible-install.html#ansible-主机清单" class="sidebar-link reco-side-ansible-主机清单" data-v-70334359>ansible 主机清单</a></li><li class="level-2" data-v-70334359><a href="/blogs/ansible/ansible-install.html#ansible-常用命令" class="sidebar-link reco-side-ansible-常用命令" data-v-70334359>ansible 常用命令</a></li><li class="level-3" data-v-70334359><a href="/blogs/ansible/ansible-install.html#ansible-命令集" class="sidebar-link reco-side-ansible-命令集" data-v-70334359>ansible 命令集</a></li><li class="level-3" data-v-70334359><a href="/blogs/ansible/ansible-install.html#ansible-doc-命令" class="sidebar-link reco-side-ansible-doc-命令" data-v-70334359>ansible-doc 命令</a></li><li class="level-3" data-v-70334359><a href="/blogs/ansible/ansible-install.html#ansible-命令详解" class="sidebar-link reco-side-ansible-命令详解" data-v-70334359>ansible 命令详解</a></li><li class="level-3" data-v-70334359><a href="/blogs/ansible/ansible-install.html#ansible-配置公私钥" class="sidebar-link reco-side-ansible-配置公私钥" data-v-70334359>ansible 配置公私钥</a></li></ul></main> <!----></div></div></div></div><div class="global-ui"><div class="back-to-ceiling" style="right:1rem;bottom:6rem;width:2.5rem;height:2.5rem;border-radius:.25rem;line-height:2.5rem;display:none;" data-v-c6073ba8 data-v-c6073ba8><svg t="1574745035067" viewBox="0 0 1024 1024" version="1.1" xmlns="http://www.w3.org/2000/svg" p-id="5404" class="icon" data-v-c6073ba8><path d="M526.60727968 10.90185116a27.675 27.675 0 0 0-29.21455937 0c-131.36607665 82.28402758-218.69155461 228.01873535-218.69155402 394.07834331a462.20625001 462.20625001 0 0 0 5.36959153 69.94390903c1.00431239 6.55289093-0.34802892 13.13561351-3.76865779 18.80351572-32.63518765 54.11355614-51.75690182 118.55860487-51.7569018 187.94566865a371.06718723 371.06718723 0 0 0 11.50484808 91.98906777c6.53300375 25.50556257 41.68394495 28.14064038 52.69160883 4.22606766 17.37162448-37.73630017 42.14135425-72.50938081 72.80769204-103.21549295 2.18761121 3.04276886 4.15646224 6.24463696 6.40373557 9.22774369a1871.4375 1871.4375 0 0 0 140.04691725 5.34970492 1866.36093723 1866.36093723 0 0 0 140.04691723-5.34970492c2.24727335-2.98310674 4.21612437-6.18497483 6.3937923-9.2178004 30.66633723 30.70611158 55.4360664 65.4791928 72.80769147 103.21549355 11.00766384 23.91457269 46.15860503 21.27949489 52.69160879-4.22606768a371.15156223 371.15156223 0 0 0 11.514792-91.99901164c0-69.36717486-19.13165746-133.82216804-51.75690182-187.92578088-3.42062944-5.66790279-4.76302748-12.26056868-3.76865837-18.80351632a462.20625001 462.20625001 0 0 0 5.36959269-69.943909c-0.00994388-166.08943902-87.32547796-311.81420293-218.6915546-394.09823051zM605.93803103 357.87693858a93.93749974 93.93749974 0 1 1-187.89594924 6.1e-7 93.93749974 93.93749974 0 0 1 187.89594924-6.1e-7z" p-id="5405" data-v-c6073ba8></path><path d="M429.50777625 765.63860547C429.50777625 803.39355007 466.44236686 1000.39046097 512.00932183 1000.39046097c45.56695499 0 82.4922232-197.00623328 82.5015456-234.7518555 0-37.75494459-36.9345906-68.35043303-82.4922232-68.34111062-45.57627738-0.00932239-82.52019037 30.59548842-82.51086798 68.34111062z" p-id="5406" data-v-c6073ba8></path></svg></div><div class="reco-bgm-panel" data-v-b1d3339e><audio id="bgm" src="/music/1.m4a" data-v-b1d3339e></audio> <div class="reco-float-box" style="bottom:200px;z-index:999999;display:none;" data-v-b1d3339e data-v-41bcba48 data-v-b1d3339e><img src="https://y.qq.com/music/photo_new/T002R300x300M0000046Etze42qCxC_1.jpg" data-v-b1d3339e></div> <div class="reco-bgm-box" style="left:10px;bottom:10px;z-index:999999;" data-v-b1d3339e data-v-41bcba48 data-v-b1d3339e><div class="reco-bgm-cover" style="background-image:url(https://y.qq.com/music/photo_new/T002R300x300M0000046Etze42qCxC_1.jpg);" data-v-b1d3339e><div class="mini-operation" style="display:none;" data-v-b1d3339e><i class="reco-bgm reco-bgm-pause" style="display:none;" data-v-b1d3339e></i> <i class="reco-bgm reco-bgm-play" style="display:none;" data-v-b1d3339e></i></div> <div class="falut-message" style="display:none;" data-v-b1d3339e>
          播放失败
        </div></div> <div class="reco-bgm-info" data-v-b1d3339e data-v-41bcba48 data-v-b1d3339e><div class="info-box" data-v-b1d3339e><i class="reco-bgm reco-bgm-music music" data-v-b1d3339e></i>苍穹</div> <div class="info-box" data-v-b1d3339e><i class="reco-bgm reco-bgm-artist" data-v-b1d3339e></i>韩磊</div> <div class="reco-bgm-progress" data-v-b1d3339e><div class="progress-bar" data-v-b1d3339e><div class="bar" data-v-b1d3339e></div></div></div> <div class="reco-bgm-operation" data-v-b1d3339e><i class="reco-bgm reco-bgm-last last" data-v-b1d3339e></i> <i class="reco-bgm reco-bgm-pause pause" style="display:none;" data-v-b1d3339e></i> <i class="reco-bgm reco-bgm-play play" data-v-b1d3339e></i> <i class="reco-bgm reco-bgm-next next" data-v-b1d3339e></i> <i class="reco-bgm reco-bgm-volume1 volume" data-v-b1d3339e></i> <i class="reco-bgm reco-bgm-mute mute" style="display:none;" data-v-b1d3339e></i> <div class="volume-bar" data-v-b1d3339e><div class="bar" data-v-b1d3339e></div></div></div></div> <div class="reco-bgm-left-box" data-v-b1d3339e data-v-41bcba48 data-v-b1d3339e><i class="reco-bgm reco-bgm-left" data-v-b1d3339e></i></div></div></div><!----></div></div>
    <script src="/assets/js/app.b9ccfc55.js" defer></script><script src="/assets/js/4.8390fbcb.js" defer></script><script src="/assets/js/1.3334f995.js" defer></script><script src="/assets/js/61.f58e6c18.js" defer></script>
  </body>
</html>
